/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta.components.category;

import de.swta.components.category.Category;
import de.swta.components.category.CategoryManager;
import org.apache.wicket.model.LoadableDetachableModel;

/**
 *
 * @author JKorreck
 */
public class DetacheableCategoryModel extends LoadableDetachableModel {

    String name;

    public DetacheableCategoryModel(Category cat) {
        this(cat.getName());
    }

    public DetacheableCategoryModel(String name) {
        this.name = name;
    }

    @Override
    protected Object load() {
        return CategoryManager.getInstance().getCategory(name);
    }

}
